package com.disv.support.exception;

import com.disv.service.resp.CommonRespCode;
import com.disv.service.resp.ReturnResp;
import lombok.Getter;

/**
 * 业务异常
 *
 * @author hyt
 * @date 2023/06/09
 */
public class BusinessException extends RuntimeException {

    @Getter
    private ReturnResp returnResp;

    public BusinessException() {
        this(CommonRespCode.INTERNAL_SERVER_ERROR);
    }

    public BusinessException(ReturnResp returnResp) {
        super(returnResp.getMessage());
        this.returnResp = returnResp;
    }

    public BusinessException(ReturnResp returnResp, Throwable cause) {
        super(returnResp.getMessage(), cause);
        this.returnResp = returnResp;
    }

}
